package com.seguriapp.common.gwt.client;

import net.customware.gwt.dispatch.client.DispatchAsync;

import com.google.web.bindery.event.shared.Event;

/**
 * Evento disparado cuando se ejecuta una accion usando el {@link DispatchAsync}
 */
public class ActionExecutedEvent extends Event<ActionExecutedEventHandler> {

  public static final Type<ActionExecutedEventHandler> TYPE =
      new Type<ActionExecutedEventHandler>();

  private String actionName;

  public ActionExecutedEvent(final String name) {
    actionName = name;
  }

  @Override
  protected void dispatch(final ActionExecutedEventHandler handler) {
    handler.onActionExecuted(this);
  }

  @Override
  public Event.Type<ActionExecutedEventHandler> getAssociatedType() {
    return TYPE;
  }

  public String getActionName() {
    return actionName;
  }
}
